import _ from 'lodash'
// 数字千分位分隔
// eslint-disable-next-line import/prefer-default-export
export const formatSplitBit = num => {
    const isString = _.isString(num)
    if (!isString && !_.isNumber(num)) {
        return num
    }
    if (isString) {
        const tmp = +num
        if (isNaN(tmp)) {
            return num
        }
        num = tmp
    }
    return num.toString().indexOf('.') !== -1
        ? num.toLocaleString()
        : num.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,')
}